/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-03-26     huger       the first version
 */
#ifndef APPLICATIONS_MAGNETIC_MAGNETIC_H_
#define APPLICATIONS_MAGNETIC_MAGNETIC_H_

//#include "Bsp/bsp.h"

#define AS5600_ADDR                  0x36    /* 从机地址 */
#define AS5600_GET_DATA              0x0C    /* 获取数据命令 */

class Magnetic
{
public:
    Magnetic();
    virtual ~Magnetic();

    float magnetic_encoder_degree_get(void);
    float magnetic_encoder_velocity_clc(unsigned short int time_sample);

    unsigned int magnetic_encoder_vaule_get(void);

    float  correct_degree;
    void CorrectDegree(void);

    const unsigned int resolution = 4096;
    const float per_degree = 360.0/4096;


    float  degree_start;
    float  degree_preview;
    float  degree_now;


private:

//    const unsigned int resolution = 4096;
//    const float per_degree = 360.0/4096;



    int numberofTurns;
    int quadrantNumber;
    int previousquadrantNumber;
};

#endif /* APPLICATIONS_MAGNETIC_MAGNETIC_H_ */
